package com.eep.logging;

/**
 *
 * @author Brian Laick
 */
public class LogEvent
{
    private String username = null;
    private String dateTimeStamp = null;
    private int orderNumber = -1;
    private LogType logType = null;
    private LogEventType logEventType = null;

    public LogEvent(LogEventType logEvent)
    {
        this("GenericUser", null, logEvent);
    }

    public LogEvent(String username, LogType logType, LogEventType logEventType)
    {
        this(username, logType, logEventType, -1);
    }

    public LogEvent(String username, LogType logType, LogEventType logEventType, int orderNumber)
    {
        if (logType == null && logEventType != null)
        {
            switch (logEventType)
            {
                case Login:
                case Logout:
                case LoginFailed:
                    this.logType = LogType.Security;
                    break;
                case OrderSubmitted:
                case OrderModified:
                case OrderCancelled:
                    this.logType = LogType.Order;
                    break;
                case OrderShipped:
                    this.logType = LogType.Shipping;
                    break;
            }
        }
        else
        {
            
            this.logType = logType;
        }
        this.username = username;
        this.orderNumber = orderNumber;
        this.logEventType = logEventType;
    }
    
    public LogEvent(String dateTimeStamp, String username, LogType logType, LogEventType logEventType, int orderNumber)
    {
       this.dateTimeStamp = dateTimeStamp;
       this.username = username;
       this.logType = logType;
       this.logEventType = logEventType;
       this.orderNumber = orderNumber;
    }

    public int getOrderNumber()
    {
        return orderNumber;
    }

    public String getUsername()
    {
        return username;
    }

    public String getLogType()
    {
        return logType.getLogDescription();
    }

    public String getLogEventType()
    {
        return logEventType.getEventDescription();
    }

   public String getDateTimeStamp()
   {
      return dateTimeStamp;
   }
    
}
